-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Ask the external provider for type info first in visitAnyNominalTypeRef #61081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ask the external provider for type info first in visitAnyNominalTypeRef #61081
Conversation
@swift-ci smoke test |
} | ||
|
||
auto FD = TC.getBuilder().getFieldTypeInfo(TR); | ||
if (FD == nullptr || FD->isStruct()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it were safer to just move it into the if (FD == nullptr || FD->isStruct())
condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we want ExternalTypeInfo
to be consulted when FD->isStruct()
is true? In other words, should external lookup happen only when FD == nullptr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are two situations where we want to ask the external provider:
- We don't have any metadata for the type, ask the external provider.
- We have metadata for the type and it's a builtin (builtins are structs), ask the external provider as it may have more accurate information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in those two situations, should they be checked after TC.getBuilder().getFieldTypeInfo(TR)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently this change checks before finding out whether either of those two cases apply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup! Just updated the patch :)
b6accec
to
7c18cdd
Compare
@swift-ci smoke test |
@swift-ci smoke test macOS |
} | ||
|
||
const TypeInfo *visitAnyNominalTypeRef(const TypeRef *TR) { | ||
auto AskExternalTypeInfoProvider = [&]() -> const TypeInfo * { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about queryExternalTypeInfoProvider
?
C/C++ imported types have Builtin type metadata. Ask the external provider when the type info we have is builtin.
7c18cdd
to
b30fc55
Compare
@swift-ci smoke test |
@swift-ci smoke test macOS |
@swift-ci test |
1 similar comment
@swift-ci test |
Looks like TestSwiftFoundation crashed. |
@adrian-prantl it's actually |
@swift-ci smoke test macOS |
C++ imported types have Builtin type metadata. Ask the external provider before checking with builder.
This also has the added benefit
of not parsing all the typeref metadata in cases we don't have metadata for a type, but the external provider can resolve it.